# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=android-tools
pkgver=34.0.4
pkgrel=3
pkgdesc="Android platform tools"
url="https://sites.google.com/a/android.com/tools/"
# s390x, ppc64le: Unsupported by vendored BoringSSL
arch="all !s390x !ppc64le"
license="Apache-2.0 MIT"
options="net !check" # upstream doesn't have a test suite
depends="python3"
makedepends="pcre2-dev linux-headers libusb-dev gtest-dev go perl cmake
	protobuf-dev brotli-dev zstd-dev lz4-dev samurai abseil-cpp-dev"
subpackages="$pkgname-bash-completion:bashcomp:noarch"
source="https://github.com/nmeum/android-tools/releases/download/$pkgver/android-tools-$pkgver.tar.xz
	"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	CXXFLAGS="$CXXFLAGS -D_LARGEFILE64_SOURCE" \
	LDFLAGS="$LDFLAGS -Wl,--copy-dt-needed-entries" \
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_BUILD_TYPE=None
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

bashcomp() {
	default_bashcomp
	amove usr/share/android-tools/completions
}

sha512sums="
34753bbbe9ed15ce0abc54c0fce4ecd69dc8b8db734169bd2473ac439d1c414301e798493b6b31cb00ed47d5314cabfb2c56d52dab0fe2a804125ebfbcbd18c5  android-tools-34.0.4.tar.xz
"
